<template>
  <div class="answer-list">
    <heads title="订单列表"></heads>
    <div class="main-content">
      <van-pull-refresh v-model="isLoading" @refresh="GetList">
        <template v-if="list && list.length>0">
          <Cell
            :ListData="item"
            v-for=" (item,index) in list"
            :key="index"
            @click.native="jump(item)"
          ></Cell>
        </template>
        <div v-else class="empty-box">没有更多数据了</div>
      </van-pull-refresh>
    </div>
  </div>
</template>

<script>
import Mock from "mockjs";
import { Toast } from "vant";
export default {
  components: {
    heads: resolve => require(["@/components/common/heads"], resolve),
    Cell: resolve => require(["@/components/common/cell"], resolve)
  },
  data() {
    return {
      isLoading: true,
      list: []
    };
  },
  watch: {},
  methods: {
    GetList() {
      this.list = Mock.mock({
        "list|3": [
          {
            "id|+1": 1,
            title: "@ctitle(4)",
            startTime: "@date()",
            type: "@ctitle(4)",
            adress: "@adress"
          }
        ]
      }).list;
      this.isLoading = false;
      // this.$ajax
      //   .post(`${this.$baseUrl}/user/mySubject`, {})
      //   .then(function(res) {
      //     console.log("当前", res);
      //     if (res.data.code == 200) {
      //       this.list = res.data.data;
      //     }
      //   })
      //   .catch(function(error) {
      //     console.log(error);
      //   });
    },
    jump(data) {
      
      this.$router.push({path: `/orderDetail/${data.id}` });
    }
  },
  created() {
    this.GetList();
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.answer-list {
  .main-content {
    min-height: 92vh;
    margin-top: 0;
    padding: 0.3rem;
    box-sizing: border-box;
  }
  .tabs {
    box-sizing: border-box;
    color: #333333;
    .cell {
    }
  }
}
</style>
